<template>
	<view>
		<u--input placeholder="请输入电话号码" border="bottom" v-model="tel" ></u--input>
		<u--input placeholder="请输入密码" border="bottom" v-model="passeord" ></u--input>
		<u-button text="登录" @click="login"></u-button> <u-button text="注册" @click="register"></u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				user:{
					tel: "",
					passeord: ""
				}
			}
		},
		methods: {
			login() {
				let that=this; 
				uni.request({
					url:"/api/user/login",
					method:'POST',
					data:that.user,
					success(res) {
						if(res.data.code==200){
							that.$refs.uToast.show({
								type: 'success',
								message: "登录成功"
							})
							uni.switchTab({
								url:"/pages/my/my"
							})
						}
					}
				})
			},
			register(){
				uni.navigateTo({
					url:"/pages/view/login/register/register"
				})
			}
		
		}
	}
</script>

<style>

</style>
